<%@ Page Language="C#" %>
<script type="text/C#" runat="server">
    private const string NoPic = "/Images/no_pic.gif";
    private void Page_Load(object sender, System.EventArgs e)
    {
        if (Page.User.Identity.Name == "")
        {
            Response.End();
        }
    }

    protected string GetNickName()
    {
    	string tmp = "";
        using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["www_user.user"].ConnectionString))
        {
            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("select NickName from t_user where memberno='" + Page.User.Identity.Name + "'", conn);
            conn.Open();
            System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                tmp = dr[0].ToString();
                break;
            }
            dr.Close();
            conn.Close();
        }
        return tmp;
    }

    protected string GetAvatar()
    {
    	string Avatar = NoPic;
        using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["www_user.user"].ConnectionString))
        {
            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("select Avatar from t_user where memberno='" + Page.User.Identity.Name + "'", conn);
            conn.Open();
            System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                Avatar = dr[0].ToString();
                Avatar = (Avatar.Trim() == "" ? NoPic : Avatar);
                break;
            }
            dr.Close();
            conn.Close();
        }
        return Avatar;
    }
</script>
<%
	/*
	 *	You need to set these variables to be appropriate for your site and user.
	 */
	String strFlashcomServer = "flashcom.italki.userplane.com";
	String strDomainID = "italki.com";
    String strSessionGUID = Page.User.Identity.Name;		// The session identifier for the currently logged in user
    String strKey = GetNickName();						// Additional login information you may need passed
	String strEvent = "";					// The event to send to the Flash Communication Server (see CSHTML.rtf)
	String strParameter = "";				// Any additional data the message needs to pass (see CSHTML.rtf)

	//Only set these if using with Webmessenger (see WMHTML.rtf)
    String strMemberID = strSessionGUID.Trim('T').TrimStart('0');				// The memberID of the currently logged in user
    String strDestinationMemberID = "";	// The memberID of the user that is on the other end of the Webmessenger


	//Do not change anything below here
	String strSwfServer = "swf.userplane.com";
	String strApplicationName = "CommunicationSuite";
	String strLocale = "english";
%>

<html>
<head>
	<title>CMD Frame</title>
</head>

<body bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" topmargin="0">

<script type="text/javascript" src="flashobject.js"></script>

<%
//	The content of this div should hold whatever HTML you would like to show in the case that the
//	user does not have Flash installed.  Its contents get replaced with the Flash movie for everyone
//	else.
%>
<div id="flashcontent">
	<strong><a href="http://www.macromedia.com/go/getflash/" target="_blank">You need to upgrade your Flash Player by clicking this link</a></strong>
</div>

<script type="text/javascript">
	// <![CDATA[

	var fo = new FlashObject("http://<%= strSwfServer %>/CommunicationSuite/cmd.swf", "cmd", "1", "1", "6", "#ffffff", false, "best");
	fo.addParam("scale", "noscale");
	fo.addParam("menu", "false");
	fo.addParam("salign", "LT");
	fo.addVariable("strServer", "<%= strFlashcomServer %>");
	fo.addVariable("strSwfServer", "<%= strSwfServer %>");
	fo.addVariable("strApplicationName", "<%= strApplicationName %>");
	fo.addVariable("strDomainID", "<%= strDomainID %>");
	fo.addVariable("strSessionGUID", "<%= strSessionGUID %>");
	fo.addVariable("strKey", "<%= strKey %>");
	fo.addVariable("strLocale", "<%= strLocale %>");
	fo.addVariable("strEvent", "<%= strEvent %>");
	fo.addVariable("strParameter", "<%= strParameter %>");
	fo.addVariable("strMemberID", "<%= strMemberID %>");
	fo.addVariable("strDestinationMemberID", "<%= strDestinationMemberID %>");
	fo.write("flashcontent");

	// COPYRIGHT Userplane 2006 (http://www.userplane.com)
	// CS version 2.0.2

	// ]]>
</script>

</body>
</html>
